import request from '@/utils/request'

// 获取分类列表
export function getCateList(params) {
  return request({
    url: '/categories',
    params
  })
}

// 获取分类数量
export function getCate(params) {
  return request({
    url: '/categories/count',
    params
  })
}

// 新建分类
export function addCategory(data) {
  return request({
    url: '/categories',
    method: 'post',
    data
  })
}

// 获取指定分类
export function categoriesDetails(id) {
  return request({
    url: `/categories/${id}`
  })
}

// 编辑分类
export function updateCategory(data) {
  return request({
    url: `/categories/${data.id}`,
    method: 'put',
    data
  })
}

// 删除分类
export function delCategory(id) {
  return request({
    url: `/categories/${id}`,
    method: 'delete'
  })
}
